<%@ Page Language="C#" MasterPageFile="AdminMasterPage.master" AutoEventWireup="true" CodeFile="NewsAdmin.aspx.cs" Inherits="Admin_NewsAdmin" Title="Untitled Page" ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <br />
    &nbsp;<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:Personal %>" DeleteCommand="DELETE FROM [News] WHERE [id] = @original_id AND [NewsTitle] = @original_NewsTitle AND [NewsCaption] = @original_NewsCaption AND [News] = @original_News AND [NewsDate] = @original_NewsDate AND [IsPublished] = @original_IsPublished AND [PhotoAvail] = @original_PhotoAvail"
        InsertCommand="INSERT INTO [News] ([NewsTitle], [NewsCaption], [News], [NewsDate], [IsPublished], [PhotoAvail]) VALUES (@NewsTitle, @NewsCaption, @News, @NewsDate, @IsPublished, @PhotoAvail)"
        OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [id], [NewsTitle], [NewsCaption], [News], [NewsDate], [IsPublished], [PhotoAvail] FROM [News]"
        UpdateCommand="UPDATE [News] SET [NewsTitle] = @NewsTitle, [NewsCaption] = @NewsCaption, [News] = @News, [NewsDate] = @NewsDate, [IsPublished] = @IsPublished, [PhotoAvail] = @PhotoAvail WHERE [id] = @original_id AND [NewsTitle] = @original_NewsTitle AND [NewsCaption] = @original_NewsCaption AND [News] = @original_News AND [NewsDate] = @original_NewsDate AND [IsPublished] = @original_IsPublished AND [PhotoAvail] = @original_PhotoAvail">
        <DeleteParameters>
            <asp:Parameter Name="original_id" Type="Int32" />
            <asp:Parameter Name="original_NewsTitle" Type="String" />
            <asp:Parameter Name="original_NewsCaption" Type="String" />
            <asp:Parameter Name="original_News" Type="String" />
            <asp:Parameter Name="original_NewsDate" Type="DateTime" />
            <asp:Parameter Name="original_IsPublished" Type="Boolean" />
            <asp:Parameter Name="original_PhotoAvail" Type="Boolean" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="NewsTitle" Type="String" />
            <asp:Parameter Name="NewsCaption" Type="String" />
            <asp:Parameter Name="News" Type="String" />
            <asp:Parameter Name="NewsDate" Type="DateTime" />
            <asp:Parameter Name="IsPublished" Type="Boolean" />
            <asp:Parameter Name="PhotoAvail" Type="Boolean" />
            <asp:Parameter Name="original_id" Type="Int32" />
            <asp:Parameter Name="original_NewsTitle" Type="String" />
            <asp:Parameter Name="original_NewsCaption" Type="String" />
            <asp:Parameter Name="original_News" Type="String" />
            <asp:Parameter Name="original_NewsDate" Type="DateTime" />
            <asp:Parameter Name="original_IsPublished" Type="Boolean" />
            <asp:Parameter Name="original_PhotoAvail" Type="Boolean" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="NewsTitle" Type="String" />
            <asp:Parameter Name="NewsCaption" Type="String" />
            <asp:Parameter Name="News" Type="String" />
            <asp:Parameter Name="NewsDate" Type="DateTime" />
            <asp:Parameter Name="IsPublished" Type="Boolean" />
            <asp:Parameter Name="PhotoAvail" Type="Boolean" />
        </InsertParameters>
    </asp:SqlDataSource>
    <br />
    <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
        DataKeyNames="id" DataSourceID="SqlDataSource1" Height="50px" Width="568px" OnItemInserted="DetailsView1_ItemInserted" OnItemUpdated="DetailsView1_ItemUpdated">
        <Fields>
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"
                SortExpression="id" />
            <asp:BoundField DataField="NewsTitle" HeaderText="NewsTitle" SortExpression="NewsTitle" />
            <asp:BoundField DataField="NewsCaption" HeaderText="NewsCaption" SortExpression="NewsCaption" />
            <asp:TemplateField HeaderText="News" SortExpression="News">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Height="135px" Text='<%# Bind("News") %>'
                        Width="554px" TextMode="MultiLine"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Height="126px" Text='<%# Bind("News") %>'
                        Width="554px" TextMode="MultiLine"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("News") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="NewsDate" HeaderText="NewsDate" SortExpression="NewsDate" />
            <asp:CheckBoxField DataField="IsPublished" HeaderText="IsPublished" SortExpression="IsPublished" />
            <asp:CheckBoxField DataField="PhotoAvail" HeaderText="PhotoAvail" SortExpression="PhotoAvail" />
            <asp:CommandField ShowEditButton="True" ShowInsertButton="True" ShowDeleteButton="True" />
        </Fields>
    </asp:DetailsView>
    <br />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" />
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"
                SortExpression="id" />
            <asp:BoundField DataField="NewsTitle" HeaderText="NewsTitle" SortExpression="NewsTitle" />
            <asp:BoundField DataField="NewsCaption" HeaderText="NewsCaption" SortExpression="NewsCaption" />
            <asp:BoundField DataField="NewsDate" HeaderText="NewsDate" SortExpression="NewsDate" />
            <asp:CheckBoxField DataField="IsPublished" HeaderText="IsPublished" SortExpression="IsPublished" />
            <asp:CheckBoxField DataField="PhotoAvail" HeaderText="PhotoAvail" SortExpression="PhotoAvail" />
        </Columns>
    </asp:GridView>
    <br />
</asp:Content>

